home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / nt_dsp1.lzh / NT_DSP1.MSA / FLOAT / FPMAC.ASM < prev    next >
Assembly Source File  |  1989-01-24  |  3KB  |  88 lines

  1. ;
  2. ; This program originally available on the Motorola DSP bulletin board.
  3. ; It is provided under a DISCLAIMER OF WARRANTY available from
  4. ; Motorola DSP Operation, 6501 Wm. Cannon Drive W., Austin, Tx., 78735.
  5. ; Last Update 30 Oct 87   Version 2.1
  6. ;
  7. fpmac   ident   2,1
  8. ;
  9. ; MOTOROLA DSP56000/1 FPLIB - VERSION 2
  10. ;
  11. ; FPMAC - FLOATING POINT MULTIPLY/ACCUMULATION SUBROUTINE
  12. ;
  13. ; Entry points: fmac_xya        R = A + X * Y
  14. ;               fmac_mxya       R = A - X * Y
  15. ;
  16. ;       m = 24 bit mantissa (two's complement, normalized fraction)
  17. ;
  18. ;       e = 14 bit exponent (unsigned integer, biased by +8191)
  19. ;
  20. ; Input variables:
  21. ;
  22. ;   X   x1 = mx  (normalized)
  23. ;       x0 = ex
  24. ;
  25. ;   Y   y1 = my  (normalized)
  26. ;       y0 = ey
  27. ;
  28. ;   A   a2 = sign extension of ma
  29. ;       a1 = ma  (normalized)
  30. ;       a0 = zero
  31. ;
  32. ;       b2 = sign extension of ea (always zero)
  33. ;       b1 = ea
  34. ;       b0 = zero
  35. ;
  36. ; Output variables:
  37. ;
  38. ;   R   a2 = sign extension of mr
  39. ;       a1 = mr  (normalized)
  40. ;       a0 = zero
  41. ;
  42. ;       b2 = sign extension of er (always zero)
  43. ;       b1 = er
  44. ;       b0 = zero
  45. ;
  46. ; Error conditions:     Set CCR L=1 if floating point overflow.  Result
  47. ;                       is set to the maximum floating point value of the
  48. ;                       correct sign.  The CCR L bit remains set until
  49. ;                       cleared by the user.
  50. ;
  51. ;                       Set CCR L=1 if floating point underflow.  Result
  52. ;                       is set to floating point zero.  The CCR L bit
  53. ;                       remains set until cleared by the user.
  54. ;
  55. ; Assumes n0, m0, shift constant table and scaling modes
  56. ; initialized by previous call to the subroutine "fpinit".
  57. ;
  58. ; Alters Data ALU Registers
  59. ;       a2      a1      a0      a
  60. ;       b2      b1      b0      b
  61. ;       x1      x0      y1      y0
  62. ;
  63. ; Alters Address Registers
  64. ;       r0
  65. ;
  66. ; Alters Program Control Registers
  67. ;       pc      sr
  68. ;
  69. ; Uses 1 location on System Stack
  70. ;
  71. fmac_xya move   a,fp_space:fp_temp+1    ;save ma
  72.         move    b,fp_space:fp_temp+2    ;save ea
  73.         jsr     fmpy_xy                 ;multiply x*y first
  74.         move    fp_space:fp_temp+1,x1   ;restore ma
  75.         move    fp_space:fp_temp+2,x0   ;restore ea
  76.         jmp     fadd_xa                 ;add product to a
  77. ;
  78. fmac_mxya move  a,fp_space:fp_temp+1    ;save ma
  79.         move    b,fp_space:fp_temp+2    ;save ea
  80.         jsr     fmpy_xy                 ;multiply x*y first
  81.         move    a,x1                    ;save product mantissa
  82.         move    b,x0                    ;save product exponent
  83.         move    fp_space:fp_temp+1,a    ;restore ma
  84.         move    fp_space:fp_temp+2,b    ;restore ea
  85.         jmp     fsub_xa                 ;subtract product from a
  86.  
  87.